package com.visizen.wisdomclass.server.client;

import com.visizen.wisdomclass.server.model.WcDistrict;
import com.visizen.wisdomclass.server.model.WcDistrictExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface WcDistrictMapper {
    @SelectProvider(type=WcDistrictSqlProvider.class, method="countByExample")
    int countByExample(WcDistrictExample example);

    @DeleteProvider(type=WcDistrictSqlProvider.class, method="deleteByExample")
    int deleteByExample(WcDistrictExample example);

    @Delete({
        "delete from wc_district",
        "where DISTRICT_ID = #{DISTRICT_ID,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(String DISTRICT_ID);

    @Insert({
        "insert into wc_district (DISTRICT_ID, PARENT_ID, ",
        "DISTRICT_NAME, LEVEL)",
        "values (#{DISTRICT_ID,jdbcType=VARCHAR}, #{PARENT_ID,jdbcType=VARCHAR}, ",
        "#{DISTRICT_NAME,jdbcType=VARCHAR}, #{LEVEL,jdbcType=INTEGER})"
    })
    int insert(WcDistrict record);

    @InsertProvider(type=WcDistrictSqlProvider.class, method="insertSelective")
    int insertSelective(WcDistrict record);

    @SelectProvider(type=WcDistrictSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="DISTRICT_ID", property="DISTRICT_ID", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="PARENT_ID", property="PARENT_ID", jdbcType=JdbcType.VARCHAR),
        @Result(column="DISTRICT_NAME", property="DISTRICT_NAME", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL", property="LEVEL", jdbcType=JdbcType.INTEGER)
    })
    List<WcDistrict> selectByExample(WcDistrictExample example);

    @Select({
        "select",
        "DISTRICT_ID, PARENT_ID, DISTRICT_NAME, LEVEL",
        "from wc_district",
        "where DISTRICT_ID = #{DISTRICT_ID,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="DISTRICT_ID", property="DISTRICT_ID", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="PARENT_ID", property="PARENT_ID", jdbcType=JdbcType.VARCHAR),
        @Result(column="DISTRICT_NAME", property="DISTRICT_NAME", jdbcType=JdbcType.VARCHAR),
        @Result(column="LEVEL", property="LEVEL", jdbcType=JdbcType.INTEGER)
    })
    WcDistrict selectByPrimaryKey(String DISTRICT_ID);

    @UpdateProvider(type=WcDistrictSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") WcDistrict record, @Param("example") WcDistrictExample example);

    @UpdateProvider(type=WcDistrictSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") WcDistrict record, @Param("example") WcDistrictExample example);

    @UpdateProvider(type=WcDistrictSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WcDistrict record);

    @Update({
        "update wc_district",
        "set PARENT_ID = #{PARENT_ID,jdbcType=VARCHAR},",
          "DISTRICT_NAME = #{DISTRICT_NAME,jdbcType=VARCHAR},",
          "LEVEL = #{LEVEL,jdbcType=INTEGER}",
        "where DISTRICT_ID = #{DISTRICT_ID,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(WcDistrict record);
}